﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CANO.Data.Helpers;

namespace CANO.WebSite.UserControls
{
	public partial class ucNavigationMenu : System.Web.UI.UserControl
	{
		

		protected void Page_Load(object sender, EventArgs e)
		{
			currentUserID.Value = Session["CurrentUserID"].ToString();

			if (!Page.IsPostBack)
			{
				foreach (var item in Request.QueryString.AllKeys)
				{
					if (item.Contains("ID"))
					{
						var searchId = string.Empty;

						if (Request.QueryString["hiddenIDContactResult"] != null)
						{
							searchId = Request.QueryString["hiddenIDContactResult"];
						}
						else if (Request.QueryString["ctl00$ucNavigationMenu$hiddenIDContactResult"] != null)
						{
							searchId = Request.QueryString["ctl00$ucNavigationMenu$hiddenIDContactResult"];
						}
						else if(Request.QueryString["ucNavigationMenu$hiddenIDContactResult"] != null)
						{
							searchId = Request.QueryString["ucNavigationMenu$hiddenIDContactResult"];
						}

						if(searchId != string.Empty && searchId != null)
							Response.Redirect("/contacts/contact.aspx?ContactID=" + searchId, true);
					}
				}

			

				if ((Int32)Session["CurrentRolID"] == Convert.ToInt32(Enums.Rol.Gerencial))
				{
					pnlSiteAdmin.Visible = true;
				}
			}
		}
	}
}